g*****g 发帖数: 34805 | 1 我不是bash python/ruby,最近scripting language 的hype很多,
想了解一下主要好处和一些关键问题怎么解决。
python/ruby的行数比java要短,相对而言java verbose。这个毫无疑问,
但我个人认为想占用了主要时间,而不是写代码本身。我个人不是很相信
特定任务以外,能有5倍的生产率。
python |
|
X****r 发帖数: 3557 | 2 # method 5: save in a closure
# pros: really good encapsulation
# cons: verbose
def _func_with_static_var():
static_var = [0]
def actual_func():
static_var[0] += 1
print static_var[0]
return actual_func
func_with_static_var = _func_with_static_var() |
|
g*****g 发帖数: 34805 | 3 It's a little verbose but one liner in java too.
BufferedReader r = new BufferedReader(new InputStreamReader(GZIPInputStream(
new FileInputStream("foo.gz"))));
String s;
while((s=r.readLine())!=null) ...
r.close(); |
|
g*****g 发帖数: 34805 | 4 It's duck typed. And you can end up with run time error for
incompatible types. You have to rely on tests to guarantee
quality. And almost all software are undertested now.
Static typed languages, as verbose as they are, provide such
check in compilation time. Yes, you can still have bugs, but
compilers give you a list of basic tests at least. |
|
L***n 发帖数: 6727 | 5 latex 对数学公式的表达方式基本上就是一个人念公式念出声的表达方式,
基本上不会有其他方式比这个更简明了(可能troff eqn好一点点,更接近
人类语言,但是也更verbose, 这俩基本上没啥本质区别),除了tex和troff,
还有其他什么更简明的写数学公式的方式么? |
|
g*****g 发帖数: 34805 | 6 This is the encapsulation principle in OOP. It looks verbose, but when you
change the implementation, you can keep the contract intact.
e.g. You may introduce another variable that's directly linked to this
variable, you are supposed to update these two values at the same time. Now
you can update that variable in the setter and all callers won't be affected.
When you are making public APIs, or modulized a big system. These patterns
to help decoupling are important. |
|
c*****m 发帖数: 1160 | 7 zhaoce073 说可以在getter/setter里加入更多的process
goodbug说可以顺便管理其他变量
devilphoenix说方便debug
前两个理由是否违反“单一功能”的要求?比如md5计算,应该是另一个函数,而不是
getter了。如果顺便管理另一个函数,那么function名字就不应该是SetThisVariable(
),而应该是SetThisVariableAndAnotherVariable().
我觉得不超过 1/10的变量需要有这方面的需求;对于其他 9/10的变量就是verbose,
看起来不爽,当然也没有坏处。
you |
|
d**********x 发帖数: 4083 | 8 按照他的意思,这个东西不应该叫做setX,应该叫做updateX之类的东西
不是
verbose, |
|
g*****g 发帖数: 34805 | 9 Linq is a syntax sugar. What Linq can do, collection operation etc. can be
done by Java, in a more verbose way. You are making the wrong statement. |
|
k*****a 发帖数: 1463 | 10 This guy typically don't know what he is talking about, neither does he
understand the context. His intention really begs to ask whether he is able
to follow the logic and understood the questions.
If he don't understand what he is talking about, why bother. When you talk
about A, syntactic sugar , he was thinking you are on topic B ... LOL
What qualifies as syntax sugar? From his statement, he admitted Linq is just
the opposite (introduce logic coding for a sugar).
"Linq is a syntax sugar. What... 阅读全帖 |
|
l*********s 发帖数: 5409 | 11 anyway, no more C# vs. Java topics please. It is not longer entertaining and
utterly useless.
Most of us don't get to choose what languages/platform to use, and there is
much more to consider than saving some keystrokes when choosing a technology
.
Java has proved itself with well-known products, and the
market demand will remain sizable for the years to come. I don't like Java's
verbosity, but it is definitely a language I have to learn.
|
|
n*w 发帖数: 3393 | 12 下班浏览的一下goodbug给的那篇硕士thesis。先不说论文质量。通篇也没说linq是
syntactic sugar。
其中涉及linq和syntactic sugar有关系有两处。
1. A number of new features were added to C# 3.0 in order to provide LINQ.
Individually most of these features can be classified as syntactic sugar
that, while helpful in cutting down on the tediousness of repetitive code,
have viable – albeit more verbose – workarounds in the language。
这里讲到linq用了c# 3.0里syntactic sugar的语言features。最明显的应该是type
inference。很多情况linq返回的type非常复杂。type inference在这里是极方便。
2. The q... 阅读全帖 |
|
c****e 发帖数: 1453 | 13 twisted should port c# "await" over, the code would be less verbose. |
|
c****e 发帖数: 1453 | 14 贴个完整程序吧。看了一下,感觉
(1)verbose,自己要写这么多send/receive message?
(2) 丢了类型检查?都通过字符串来传.
如果只是考虑async, threading简单,还是python, c#那样的coroutine更好用。而且
你这个对于Akka有什么优势吗? |
|
o**2 发帖数: 168 | 15 贴程序是个好建议,多谢。
1) 有初始设置,但使用不会觉得verbose
2) 对,没有静态类型检查;和字符串无关
完整的比较现在还没有做,突出的有几点:
a) FMP是基于OOP的,同时支持imperative和event-driven programming
b) 除了直接指定receiving active object,还支持动态的routing addressing
c) 可以在其他OO甚至非OO语言上实现,用法一致 (现有Java,C#,和JavaScript版)
d) 支持两种thread models:Java和C#的shared-memory by threads;JavaScript的
dedicated-momery per thread
e) 支持progamming in the large:messenger除了是container外,还是building
block |
|
c****e 发帖数: 1453 | 16 I know immutable. But it's python's complier's job to optimize this.
javascript used to be slow to s+=, now it's even faster than stringbuidler
because people like to write in that way.
I agree the way he wrote is not every FP. where|join can make code more
expressive. But my point is even his code is verbose, as long as it works it
could be fine. I don't know your concrete story, but don't laugh at
novince. He might just need a little bit practice and learn a few
conventions.
Back to the post, ... 阅读全帖 |
|
n*w 发帖数: 3393 | 17 http://blog.lahteenmaki.net/2013/04/java-streams-vs-c-linq-vs-j
不知道现在有没有streams to database,streams to xml, streams to events....
等等?
作者抱怨streams verbose。“Based on these examples I have a funny feeling
that Java8 Streams API is going to be a failure. And since developers will
not be able to extend it with useful constructs, it may well end up being
just another nail in the coffin.” |
|
s*******g 发帖数: 243 | 18 是很verbose,稍微复杂点就影响可读性了。FP的语言抛开不谈,C#, C++11, Python里
面的都清爽很多,绝大多数时候都提高了代码可读性。不知道为什么Java的不能设计的
简洁点,做comipler的偷懒还是JVM里有什么限制? |
|
g*****g 发帖数: 34805 | 19 同意verbose一点没啥大不了的,一堆单词肯定比一堆符号好读多了,
Java从来就不是什么简洁的语言。追求简洁的,直接上
scala好了,java 怎么改都不会有scala简洁的。如果不是最近scala, node这波,
估计lambda都不会往里加。 |
|
n*w 发帖数: 3393 | 20 FP + dynamical的强有力 vs java的verbose。 |
|
g*****g 发帖数: 34805 | 21 Saying Lisp is better than XML is like saying J is better than Java because
it's more terse. There's a reason J never went anywhere, like Lisp,
Readability. Exactly where XML excels.
Most server side applications have the bottleneck on the DB. And you don't
see XML running there. It's always some binary protocol supporting SQL on
higher level. XML is verbose and slower to parse for application servers,
but the bottleneck is not there. It's the number of the requests, not the
size of the requests... 阅读全帖 |
|
c******o 发帖数: 1277 | 22 我个人做的,最大就10万,还是java之类的verbose static语言,
动态语言,超过1-2万就很难维护了。
bug |
|
d****i 发帖数: 4809 | 23 支持好虫和楼上几位的观点,语言增加一些不必要的语法糖,有百害而无一益,
verbose一点又有什么关系,更清楚明了,让初学者概念清晰,不要去追求奇技淫巧。
所以C++11某些添加的东西显然是走在错误的道路上,比如auto这个东西,本身就是和C
的auto变量产生歧义冲突。 |
|
g*****g 发帖数: 34805 | 24 It's verbose but typically reduces bugs upfront. Many exceptions can be
ignored. Checked exception forces you to make a decision. Without it you may
realize you should catch and ignore an exception after a production bug.
常。 |
|
l**********n 发帖数: 8443 | 25 YAML is a serialization format which is more expressive than JSON and less
verbose than XML. AND it is compatible with JSON. |
|
g*****g 发帖数: 34805 | 26 Grail就是spring mvc + hibernate用Groovy写。spring mvc没有什么问题,纯粹是用
java verbose而已。ROR比Spring MVC晚。web前端JVM可以做,但是前景不如NodeJs。 |
|
c*******0 发帖数: 5247 | 27
事实上到目前为止,改头门第的人,来自Python和Ruby圈的最多。反而是因为Go的GC特
性让很多C/C++不愿意改投门第。
商业逻辑这方面转Go的确实少,Go本来也没打算在这方面和Java争。Go大部分是做
infra的。
个习惯问题,比如Swift style和Go类似,很多objc的人转了几周也就适应了。
我老早就在这里说了,Go不可能取代Java,Go的目标也不是取代Java。Java dominate
的地位,只要Android不倒,JVM不倒,是不会被动摇的。
同意
既然说到这了,我就多说几句。
Go是一门设计理念非常清晰但是顽固的语言。和别的语言不同,Go并不希望成为一个
one language rule them all。在一开始设计的时候,Go team的人的目标很简单,就
是满足Google内部做多team大规模infra的需求。注意,这个“多team大规模”是目标
,不是期盼。因为这个目标,所以才会有Go boring的语法,少得可怜的特性,和及其
简单的上手,以及超强的可读性。
Go社区的人喜欢Go,完全不是因为什么语言牛逼的特性,也不是什么best pe... 阅读全帖 |
|
c*******0 发帖数: 5247 | 28
当然不是了,如果有人得出这种结论,只能说没在工业界呆过。C++同样的程序大部分
比Java短,谁更易读?
哪些人认可?FP爱好者?
这里问题很清晰啊,做同样一个东西,robustness相同,有什么数据能证明代码越短,
所花时间越少?Again,Java就是一个典型例子,verbose的style导致Java程序比大部
分语言程序都长,所以Java的效率最低?那工业界的人都是脑子被驴踢了。很多情况下
因为IDE,半个小时不到就能写几百行Java做不少事情,但因为代码长所以你这半个小
时的效率特别低?
这种sample一点意义都没有。你比比Java的commit和Matlab的commit?是不是说明
Matlab的效率比Java高?
我说了,如果你真的要比,很简单,所有条件都一样所花的时间,比如同样的
application,同样的用户量,同样的bug级别,同样的性能。然后你来比做这个
application所用的时间。
别的比较都是过家家,当不得真的。 |
|
z****e 发帖数: 54598 | 29 当你还不会用eclipse等ide的时候
你谈java如何verbose就是个joke |
|
|
g*****g 发帖数: 34805 | 31 With defined fields, a java bean is a few clicks away to generate these
functions in a modern day IDE, probably taking less time to write than a
case class in Scala.
I am not denying Java is more verbose, but it also offers more flexibility,
like sometimes you want to override setter. |
|
w**z 发帖数: 8232 | 32 http://www.tiobe.com/index.php/content/paperinfo/tpci/index.htm
Java is now almost 4.5% ahead of the rest of the pack. We have to go back to
2008 to see such a big difference between Java and the number 2 of the
TIOBE index. Java version 8 is clearly a success. This is mainly thanks to
the functional programming idiom that has been added to this latest version.
Java went in decline when Oracle bought Sun Microsystems (and thus Java) in
2010. Several Java gurus left the company, being afraid that... 阅读全帖 |
|
z****e 发帖数: 54598 | 33
封装是oop的精髓,所有的oop都强调封装
java甚至连static method都强行要求封装
这个对于1st class ctizien func来说是没有要求的
你不能把封装这个oop的精髓给拿走了,然后批判说,oop的继承是无用的
实际上继承和多态纯粹是副产品,oop自己都不用
java的verbose说的就是无时无刻都要求的封装,也就是各种包装
oop并没有无论什么时候都要求继承和多态,只有封装是无论什么时候都要求的
而这个恰恰是 大 项目很看重的一点,封装才是经典的oop思想
你不能为了批判而故意扭曲某些概念,pp和fp根本不强调封装
强调封装,模块化,恰恰就是oop的那条路 |
|
e***i 发帖数: 231 | 34 抛个砖
1. typed (good for maintenance)
2. low-level and verbose, can do anything (general purpose)
3. compile once, run everywhere (JVM)
4. huge eco-system and community
更多的可以问专家,比如
好虫 和 古德霸 |
|
l*********s 发帖数: 5409 | 35 it seems that the ctor of std::thread is invoking copy ctor of the argument
and passing by values, and probably your Server object is a singleton and
not copy-able.
I suspect vs2015 has an option for verbose error messages, in gcc it is
going to be a tall stack of errors and you can trace back to your source
code. |
|
发帖数: 1 | 36 The major languages in IT (Information Technology) are:
Java - the general-purpose enterprise standard heavily used for server-side
web development; used to write Android apps
Python - general-purpose scripting language, popular for numerical computing
, financial industry, web development, etc.
PHP - used for server-side web development
C# - general-purpose and largely Windows-centric
C++ - general-purpose and high-performance; used for nearly everything, esp.
financial industry, scientific com... 阅读全帖 |
|
S*******e 发帖数: 525 | 37 自学些东西,最好向大师请教--几秒可能解决问题。
试了http://machinelearningmastery.com/multi-class-classification-tutorial-keras-deep-learning-library/
在最后加了
model = baseline_model()
model.fit(X, dummy_y, nb_epoch=200, batch_size=5, verbose=1)
pre = model.predict(X)
print(pre)
这个预测的结果是nx3矩阵,是不是那3个数相当于“概率”?怎样判断这一行预测的对?
譬如: [ 9.85160708e-01 1.30239958e-02 1.72271675e-09] 非常接近
【1,0,0】。这可以说就是这一类。
可以下这些我就不知怎么解释了, 大牛给小白指点指点?(又想了一想: 是不是和【
1,0,0】,【0,1,0】, 【0,0,1】中最近的一个,就是那一类?)
6.46205149e-13 4.29476095e-05 2.59178039e... 阅读全帖 |
|
h**********c 发帖数: 4120 | 38 printgcdetails, java 8 要加verbose
可以上SQL,成本低点。 |
|
t***s 发帖数: 88 | 39 \usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm}
改成你想要的 |
|
j*******r 发帖数: 201 | 40 I just wrote a batch file to download files by ftp like this:
ftp -n 128.104.1.1
user yang yangpwd
ascii
verbose
cd data
get aaa.zip
close
bye
But after being connected, it stopped before verifying username
and password. Can anyone tell me what's wrong?
Thanks a lot, |
|
f****n 发帖数: 4615 | 41 Adding more space to swap space, first mkfile a big file, then "swap -a"
this file to swap file. This mkfile command has two arguments: -n and -v.
"-v" specifies verbose reporting mode. "-n" indicates that the disk space
should be allocated as needed up to the specified size( instead of all
being allocated when the file is created). I don't know the meaning
in parentheses. Can you help me? |
|
m******g 发帖数: 3924 | 42 写好文章重要的是结构和逻辑,怎莫把一个故事讲的完整有条理,能让读者信服。语言
方面,多看看同类文章怎莫表达的,然后老板做一些修饰。而且很多reviewers也不是
native speakers,只要语法和句子结构清楚,让他们能看懂就可以。有一次,我写完文
章,老板给润色,然后 我自己一看,看得都晕。
结果几个审稿人写的评语都是我wordy,verbosely 。。。。回来又改回来了。。顺便
说老板是美国人,专业领域的中牛。 |
|
l**********1 发帖数: 5204 | 43 Re LZ
here you go,
Writing Your Thesis: Advice and Tips
A thesis is a daunting thing: so massive and complex that it’s often
difficult to know even where to start. Herein MESA shares some strategies,
advice and handy tips for getting your thesis under control. And we invite
you to send in your suggestions too.
1. Start Early
The most important step, by far, is to simply start. Even if it’s just the
title page, or the acknowledgements, or some references – start. Starting
early means years ahead,... 阅读全帖 |
|
T******T 发帖数: 3066 | 44 lol, guess I was being a bit verbose...
So was I smoking crack and gave LZ bunch of mis info ? |
|
a******r 发帖数: 38 | 45 it's just the usual verbosity of English |
|
b*******x 发帖数: 100 | 46 。。什么类型的输出?你是只想要return的value吗?
如果是warning和error信息,可以用 try(exprs,T) 来抑制
如果不是,是程序内的打印输出,他们一般又自己的参数比如trace=F,verbose=F,来抑
制这种输出
如果没有相关参数,试一试sink(),把信息结果送进一个临时文件。
偶知道的就这些了。。。 |
|
i******n 发帖数: 839 | 47 Found a good review instead of any download link:
Summary: The truth about this book. 99% of other great reviews are bogus.
Rating: 2
This book was not written for students. It was written so that the author
can gain respect from his from his academic peers. The explanations are
absolutely horrible. It purposely explains simple concepts in overly verbose
, complicated ways. The idea is to make the subject appear as complicated as
possible when it doesn't need to be. It reads like those academic ... 阅读全帖 |
|
M***l 发帖数: 123 | 48 试着用R --verbose,但是怎么死在那没动了似的?
唉,折腾好几天了。 |
|
n*********e 发帖数: 318 | 49 I have built an R job on Linux.
It reads in a small input file containing parameter values. Then it reads in
a big transactions file. and then dynamically slice and dice data, and
compute all sorts of statistics and ratios.
I currently run this R job in an interactive R session by using -
> source('myJob.R', verbose=T,echo=T)
It works fine but I would really like to run it as a Linux batch job.
Have anybody had such experience of running R batch job on Unix/Linux ?
Thanks!! |
|
S******y 发帖数: 1123 | 50 许多应用程序中都会有日志记录,用于记录系统在运行过程中的一些关键信息,以便于
对系统的运行状况进行跟踪。python为我们提供了简单易用、且功能强大的日志模块:
logging
The logging module defines a standard API for reporting errors and status
information from applications and libraries. The key benefit of having the
logging API provided by a standard library module is that all Python modules
can participate in logging, so an application’s log can include messages
from third-party modules.
logging模块支持将日志信息保存,如:保存到日志文件中;以邮件的形式发送日志信
息;以http get或post的方式提交日志到web服务器;等等。
举一个简单的例子:... 阅读全帖 |
|